//
//  MainViewController.swift
//  fruit-helper-swift
//
//  Created by 赵隆杰 on 2022/6/11.
//

import UIKit

class MainViewController: UITabBarController {

    override func viewDidLoad() {
        super.viewDidLoad()

        let homeNav = NavigationController.init(rootViewController: HomeRootViewController())
        homeNav.tabBarItem.title = "首页"
        homeNav.tabBarItem.image = UIImage.init(named: "tabbar_home_normal")?.withRenderingMode(.alwaysOriginal)
        homeNav.tabBarItem.selectedImage = UIImage.init(named: "tabbar_home_select")?.withRenderingMode(.alwaysOriginal)
        
        let listNav = NavigationController.init(rootViewController: ListRootViewController())
        listNav.tabBarItem.title = "阅读"
        listNav.tabBarItem.image = UIImage.init(named: "tabbar_list_normal")?.withRenderingMode(.alwaysOriginal)
        listNav.tabBarItem.selectedImage = UIImage.init(named: "tabbar_list_select")?.withRenderingMode(.alwaysOriginal)
        
        let mineNav = NavigationController.init(rootViewController: MineRootViewController())
        mineNav.tabBarItem.title = "设置"
        mineNav.tabBarItem.image = UIImage.init(named: "tabbar_set_normal")?.withRenderingMode(.alwaysOriginal)
        mineNav.tabBarItem.selectedImage = UIImage.init(named: "tabbar_set_select")?.withRenderingMode(.alwaysOriginal)
        
        viewControllers = [homeNav, listNav, mineNav]
        tabBar.barTintColor = .white
        tabBar.tintColor = kThemeColor
        
        let appearance = UITabBarAppearance.init()
        appearance.backgroundColor = .white
        tabBar.standardAppearance = appearance
        if #available(iOS 15.0, *) {
            tabBar.scrollEdgeAppearance = appearance
        } else {
            // Fallback on earlier versions
        }
    }
    

    

}
